
from django.conf.urls import url
from . import views


app_name = 'blog'

urlpatterns = [
    #url(r'^$', views.index, name = 'index'),#‘index’ 是view.index 的别名
    url(r'^$', views.IndexView.as_view(), name='index'),  # ‘index’ 是view.index 的别名
    #表示^匹配字符的开头,(?P<pk>[0-9]+), 表示获取的pk 变量匹配一个或多个数字$ 表示字符末尾，post/255/ 是合格的，post/255/后面不能有任何数据
    #pk 这个变量会作为参数传到detail 里面
    url(r'^post/(?P<pk>[0-9]+)/$', views.detail, name = 'detail'),
    #url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', views.archives, name='archives'),
    #url(r'^category/(?P<pk>[0-9]+)/$', views.category, name='category'),
    url(r'^category/(?P<pk>[0-9]+)/$', views.CategoryView.as_view(), name='category'),
    url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', views.ArchivesView.as_view(), name='archives'),
    url(r'^tag/(?P<pk>[0-9]+)/$', views.TagView.as_view(), name='tag'),
    url(r'^search/$', views.search, name='search'),

]